package com.gerfmarquez.nymph.ui.seekbar;

import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.widget.HorizontalScrollView;

import com.gerfmarquez.nymph.ui.gesture.detectors.XScrollDetector;

public class CustomHorizontalScrollView extends HorizontalScrollView {
	private GestureDetector gestureDetectorX;
	public CustomHorizontalScrollView(Context context) {
		super(context);
		gestureDetectorX = new GestureDetector(new XScrollDetector());
		setFadingEdgeLength(0);
	}
	public CustomHorizontalScrollView(Context context, AttributeSet attrs) {
		super(context, attrs);
		gestureDetectorX = new GestureDetector(new XScrollDetector());
		setFadingEdgeLength(0);
	}

	

	@Override
	public boolean onInterceptTouchEvent(MotionEvent ev) {
//		Log.d("CustomHorizontalScrollView", "onInterceptTouchEvent:::::::::::::::::::::::::"+ev.getAction());
		boolean result = super.onInterceptTouchEvent(ev);
		if(gestureDetectorX.onTouchEvent(ev)) {
			return result;
		} else {
			return false;
		}
	}

	@Override
	public boolean onTouchEvent(MotionEvent ev) {
//		Log.d("CustomHorizontalScrollView", "onTouchEvent:::::::::::::::::::::::::"+ev.getAction());
		return super.onTouchEvent(ev);
	}
	
}
